#include "Rp2TextureEffect.h"

using namespace Rp2;

RP2_IMPLEMENT_RTTI(Rp2, TextureEffect, ShaderEffect);
RP2_IMPLEMENT_DEFAULT_NAME_ID(TextureEffect, ShaderEffect);

//---------------------------------------------------------------------------------------------------
TextureEffect::TextureEffect(const std::string& rkTextureName)
	:
	ShaderEffect(1)
{
	m_kVShader[0] = new VertexShader("Texture");
	m_kPShader[0] = new PixelShader("Texture");
	m_kPShader[0]->SetTexture(0, rkTextureName);

/*
	m_eEffect = SE_TEXTURE;
	m_iTexQuantity = 1;
	// texture setting
	Tga* tga = new Tga;
	if(!Tga::ReadTGA(rkTextureName.c_str(), tga))
		assert(false);
	if (!tga->GetData())
	{
		assert(false);
	}
	glGenTextures(1, (GLuint*)&m_iTexID[0]);
	glBindTexture(GL_TEXTURE_2D, m_iTexID[0]);

	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);	
	glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
	glTexImage2D(GL_TEXTURE_2D, 0, tga->GetComponent(), tga->GetWidth(), tga->GetHeight(), 0,
		tga->GetFormat(), GL_UNSIGNED_BYTE, tga->GetData());

	glGenerateMipmap(GL_TEXTURE_2D);

	delete tga;
*/

}
//---------------------------------------------------------------------------------------------------
TextureEffect::~TextureEffect()
{
}
//---------------------------------------------------------------------------------------------------